import JSEncrypt from '@/utils/jsencrypt.min'
// 加密公钥
const key =
	"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwjRj6I9WIYWutXk3vu7X\n" +
	"WX1Xh9BBqI0aF6UgXO2VTYr1FA9K6mXooTs3ShymUcJoGzpeT1zG3u4lJMQAHvhf\n" +
	"B+szEQYtGepo5nx2cxFSBy5h27UdQz1XE7fqGLBsRmsy5DDsBxD1SP7Az6DGNXbL\n" +
	"/nXwNMFkrplr7rGQ9D6usMMsW3Do/EDSg2QNtnxaY21vFUjEPjTXAL5yjWbjkuBs\n" +
	"8GMYZeMOjdB1rfMWLaGnL6qp/x9tHY6I4jYTlp7KLX3J7mebF7TE3NaPLSqTpjob\n" +
	"vSg8O4JfloOw84PP2oA/II1EWMJq6a/Pb6ilom9YMAhO3Ymgh/3qJQzkKDErW3e+\n" +
	"AQIDAQAB";

// 加密
export function rsaEncrypt(msg) {
	const jsencrypt = new JSEncrypt()
	jsencrypt.setPublicKey(key)
	const encryptMsg = jsencrypt.encrypt(msg)
	return encryptMsg
}

// 解密私钥
const privateKey = ``

// 解密
export function rsaDecrypt(msg) {
	const decrypt = new JSEncrypt()
	decrypt.setPrivateKey(privateKey)
	const decryptMsg = decrypt.decrypt(msg)
	return decryptMsg
}